package com.ninong.ker.admin.rest.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @author cmd
 */
@Data
public class MenuVO implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 4270270880398262615L;

    private String id;
    private String uid;

    /**
     * 上级菜单ID
     */
    private String pid;

    /**
     * 菜单类型
     */
    private String type;

    /**
     * 菜单标题
     */
    private String name;

    /**
     * 多语言name
     */
    private String lname;

    /**
     * 图标
     */
    private String icon;

    /**
     * 路径
     */
    private String path;


    /**
     * 排序
     */
    private Integer sort;

    /**
     * 权限
     */
    private String permission;

    /**
     * 组件路由
     */
    private String component;
    
    private Date createTime;

    /**
     * 修改时间
     */
    private Date updateTime;

    /**
     * 是否显示
     */
    private Boolean hidden;

    private List<MenuVO> children;
    private JSONObject meta;

    /**
     * 数据id
     */
    private String dataId;

    /**
     * 表单id
     */
    private String formCode;

    /**
     * 流程key
     */
    private String taskKey;

    private String tenantId;
    private String language;

    public JSONObject getMeta() {
        JSONObject meta = new JSONObject();
        if (StringUtils.isNotEmpty(formCode)) {
//            meta.put("id",dataId);
            meta.put("formCode",formCode);
//            meta.put("key",taskKey);
        }
        meta.put("icon", icon);
        meta.put("title", name);
        return meta;
    }

    public void setMeta(JSONObject meta) {
        this.meta = meta;
    }
}
